<?php

/**
 *
 * @author ben <ben@spicatech.cn>  Created on 2015-11-12
 */
abstract class BaseList extends ListObject {

    public $page = 1;
    public $pageSize = 20;

    public function get() {
        $list = $this->getCommand()
                        ->limit($this->pageSize, ($this->page - 1) * $this->pageSize)
                        ->queryAll();
       return $list;
    }

    public function count() {
        return $this->getCommand()->query()->count();
    }

    abstract function getCommand();
}
